From b17bad75eb79dde6714e2f39b4780d131dd0e594 Mon Sep 17 00:00:00 2001 From: Krinkle Date: Sat, 12 Feb 2011 20:08:55 +0000 Subject: [PATCH] Since mwsuggest.js is no longer used in core, wgMWSuggestTemplate is not defined either. This variable was previously defined by default. Gadgets using this broke with 1.17 since they assumed wgMWSuggestTemplate was defined just like mwsuggest.js did. I've added the definition for it inside the file itself. --- skins/common/mwsuggest.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/skins/common/mwsuggest.js b/skins/common/mwsuggest.js index d9bc737e82..134b2d8ab0 100644 --- a/skins/common/mwsuggest.js +++ b/skins/common/mwsuggest.js @@ -7,6 +7,12 @@ * by Robert Stojnic (April 2008) */ +// Make sure wgMWSuggestTemplate is defined +if ( !mw.config.exists( 'wgMWSuggestTemplate' ) ) { + mw.config.set( 'wgMWSuggestTemplate', mw.config.get( 'wgServer' ) + mw.config.get( 'wgScriptPath' ) + + "/api.php?action=opensearch\x26search={searchTerms}\x26namespace={namespaces}\x26suggest" ); +} + // search_box_id -> Results object window.os_map = {}; // cached data, url -> json_text @@ -416,7 +422,7 @@ window.os_delayedFetch = function() { var r = os_timer.r; var query = os_timer.query; os_timer = null; - var path = wgMWSuggestTemplate.replace( "{namespaces}", os_getNamespaces( r ) ) + var path = mw.config.get( 'wgMWSuggestTemplate' ).replace( "{namespaces}", os_getNamespaces( r ) ) .replace( "{dbname}", wgDBname ) .replace( "{searchTerms}", os_encodeQuery( query ) ); -- 2.20.1